<template>
  <div class="ly-header">
    <span class="sys-title">合同系统</span>
    <div class="header-panel">
			<!--
      <span class="l-group">
        <s>当前登录用户：</s>
        <s class="colorEm_or">{{userInfo.realName}}</s>
      </span>
			-->
      <i v-if="false" class="fa fa-cog p-btn"></i>      
      <i class="fa fa-power-off p-btn" title="退出登录" @click="doLogOut"></i>
    </div>
  </div>
</template>

<script>
import api from '../../api'
import { baseURL } from '../../api/config.js'

export default {
  name: 'ly-header',
  data () {
    return {
      userInfo:{
        realName:"superadmin"
      }
    }
  },
  methods: {
		doLogOut(){
			api.outLogin({}).then((res)=>{
				if(res.data.code=="SUCC00000"){
					if(process.env.NODE_ENV=="development"){
						window.location.href='/login.html';
					}else if(process.env.NODE_ENV=="production"){
						window.location.href=baseURL+'/static/login.html';
					}
				}else{
          this.$message({
            message: res.data.info,
            type: 'error'
          });
				}
			}).catch((err)=>{
				console.log(err);
			});
		}
  }
}
</script>
<style lang="less" scoped>
@import "../../less/variable.less";
.ly-header{
  width:100%;
  height:60px;
  background: #20a0ff;
  color:#fff;
  .sys-title{
    color: #fff;
    font-size: 18px;
    line-height: 60px;
    float: left;
    padding-left: 50px;
  }
  .header-panel{
    float:right;
    line-height: 60px;
    >*{
      font-size:14px;
      line-height:60px;
      height:60px;
    }
    .l-group{
      margin-right:10px;
    }
    padding-right:30px;
    .p-btn{
      padding:0 10px;
      font-size:18px;
      &:hover{
        color:@colorEm_or;
        cursor:pointer;
      }
    }
  }
}
</style>
